package builder.construction;

import builder.database.Column;
import builder.database.Table;

/**
 * 
 * @author Alex
 *
 */
public interface Builder {	
	/**
	 * <br/>
	 * <ul><li><strong>join</strong></li></ul>
	 * <br/>
	 * Join a table by defining the table class and the two columns that should be used
	 * to link the given table. 
	 * <br/>
	 * One of the two column parameters is usually the identity column for the table parameter.
	 * @param Table table that should be joined with the current query
	 * @param columnLeft 
	 * @param columnRight
	 * @return 
	 */
	public Builder join(Table table, Column columnLeft, Column columnRight);
	
	/**
	 * <br/>
	 * <ul><li><strong>where</strong></li></ul>
	 * <br/>
	 * 
	 * Add conditions to a query on a certain column
	*/
	public WhereBuilder where(Column column);
	
	/**
	 * <br/>
	 * <ul><li><strong>orderByAscending</strong></li></ul>
	 * <br/>
	 * Orders the given columns in ascending order
	 * 
	 * <ul><li>Strings: A -> Z</li><li>Numbers: 0 -> 9</li></ul>
	 * <br/>
	 * @param columns list of columns that need to be sorted
	 */
	public Builder orderByAscending(Column... columns);
	
	/**
	 * <br/>
	 * <ul><li><strong>orderByDescending</strong></li></ul>
	 * <br/>
	 * Orders the given columns in descending order
	 * 
	 * <ul><li>Strings: Z -> A</li><li>Numbers: 9 -> 0</li></ul>
	 * <br/>
	 * @param columns list of columns that need to be sorted
	 * @return 
	 */
	public Builder orderByDescending(Column... columns);
	
	/**
	 * <br/>
	 * <ul><li><strong>build</strong></li></ul>
	 * <br/>
	 * Method that compiles all previous method calls into one query and returns that query.
	 * @return the final query
	 */
	public String build();
	
}
